<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('org', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('pid')->comment("父ID");
            $table->char('org_root',3)->comment('顶级机构码');
            $table->char('org_code',11)->comment('每2位一个级别，最多4个级别')->unique();
            $table->string('name')->comment('机构名称');
            $table->string('addr')->comment('所在地址');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('org');
    }
};
